package com.hellogood.yaohuo.shared.data;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * @author Administrator
 */
public class Event implements IsSerializable {

	public final static int EVENT_TYPE_ADD_DATA = 1;
	public final static int EVENT_TYPE_REMOVE_DATA = 2;
	public final static int EVENT_TYPE_CHANGE_DATA = 3;
	public final static int EVENT_TYPE_RAISE_ALARM = 4;
	public final static int EVENT_TYPE_CLEAR_ALARM = 5;
	public final static int EVENT_TYPE_SERVER_MESSAGE = 6;
	public final static int EVENT_TYPE_INNER_MESSAGE = 7;

	private Integer eventId;
	private String eventSource;
	private Integer eventType;
	private Integer entityId;

	public Event() {
		eventId = null;
		eventSource = null;
		eventType = null;
		entityId = null;
	}

	/**
	 * @return the alarmId
	 * @uml.property name="alarmId"
	 */
	public Integer getEventId() {
		return eventId;
	}

	/**
	 * @param alarmId
	 *            the alarmId to set
	 * @uml.property name="alarmId"
	 */
	public void setEventId(Integer alarmId) {
		this.eventId = alarmId;
	}

	public String getEventSource() {
		return eventSource;
	}

	public void setEventSource(String eventSource) {
		this.eventSource = eventSource;
	}

	public Integer getEventType() {
		return eventType;
	}

	public void setEventType(Integer eventType) {
		this.eventType = eventType;
	}

	public Integer getEntityId() {
		return entityId;
	}

	public void setEntityId(Integer entityId) {
		this.entityId = entityId;
	}

	public boolean equals(Event event) {
		if (this.eventSource.equals(event.eventSource)
				&& this.eventType.equals(event.eventType)
				&& ((entityId == null && event.entityId == null) || (entityId != null && event.entityId != null && this.entityId
						.equals(event.entityId)))) {
			return true;
		} else {
			return false;
		}
	}
}
